/*
* All code is only for jiecai 
* All rights reserved
*/
package com.jc.common.model;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.jc.common.util.StringUtil;

/**
 *
 * @author Kenny
 * created on 2010-12-23
 */
public class PageResultModel<T> implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@JsonProperty("cp")
	private int pageNo;
	
	@JsonProperty("pc")
	private int pageCount = -1;
	private int total;
	private int pageSize;
	
	@JsonProperty("l")
	private List<T> dataList;
	
	public PageResultModel() {
		
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getPageCount() {
		if (pageCount == -1) {
			pageCount = StringUtil.getPageCount(total, pageSize);
		}
		return pageCount;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public List<T> getDataList() {
		return dataList;
	}

	public void setDataList(List<T> dataList) {
		this.dataList = dataList;
	}
}
